package com.online.teaching.dao;
import com.github.pagehelper.PageInfo;
import com.online.teaching.pojo.Blog;
import io.swagger.annotations.ApiParam;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/****
 * @Author:admin
 * @Description:Blog的Dao
 * @Date 2019/6/14 0:12
 *****/
public interface BlogMapper extends Mapper<Blog> {
    /**
     * 管理员获取博客列表
     * @return
     */
    @Select("select * FROM blog where is_valid=1")
    public List<Blog>adminGetBlogList();

    /**
     * 删除博客
     * @param blogId
     * @return
     */
    @Update("UPDATE blog SET is_valid=0 WHERE blog_id=1")
    public Integer deleteBlog(@ApiParam("blog_id") Integer blogId);


    @Select("SELECT * FROM blog WHERE teaches_id =1 and is_valid=1")
    public List<Blog>getBlogList(@Param("teaches_id") Integer teacherId);
}
